package com.morn.fanfou.model;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

import com.morn.fanfou.exception.FanfouDBException;

public class Photo implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4424503088162944292L;

	private Integer id;

	private String imageurl;

	private String thumburl;

	private String largeurl;

	public Photo() {

	}

	public Photo(JSONObject json) throws FanfouDBException {
		init(json);
	}

	private void init(JSONObject json) throws FanfouDBException {
		if (json != null) {
			try {
				imageurl = json.getString("imageurl");
				thumburl = json.getString("thumburl");
				largeurl = json.getString("largeurl");
			} catch (JSONException e) {
				throw new FanfouDBException(e.getMessage() + ":" + json.toString(), e);
			}
		}
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getImageurl() {
		return imageurl;
	}

	public void setImageurl(String imageurl) {
		this.imageurl = imageurl;
	}

	public String getThumburl() {
		return thumburl;
	}

	public void setThumburl(String thumburl) {
		this.thumburl = thumburl;
	}

	public String getLargeurl() {
		return largeurl;
	}

	public void setLargeurl(String largeurl) {
		this.largeurl = largeurl;
	}

}
